

export default {
    mounted() {
        this.setUpLtRtKeyup();
    },
    methods: {
        setUpLtRtKeyup() {
            document.documentElement.addEventListener("keyup",this.handleKeyupFn);
        },
        handleKeyupFn(e) {
            console.log(e);
            // input输入框对象不用监听
            if (e.target.localName === 'input' || e.target.localName === 'textarea') {
                return;
            }
            let keyCode = Number(e.keyCode);
            if (keyCode === 37) {
                this.keyupLtFn();
            }
            if (keyCode === 39) {
                this.keyupRtFn();
            }
        },
        keyupLtFn() {
            this.hanldeQuiteNav('prve');
        },
        keyupRtFn() {
            this.hanldeQuiteNav('next');
        },
    },
    destroyed() {
        document.documentElement.removeEventListener("keyup",this.handleKeyupFn);
    },
}